import { defHttp } from '/@/utils/http/axios';
import { useMessage } from "/@/hooks/web/useMessage";

const { createConfirm } = useMessage();

enum Api {
	list = '/couple-activity/activity/coupleActivityMain/list',
	save = '/couple-activity/activity/coupleActivityMain/add',
	edit = '/couple-activity/activity/coupleActivityMain/edit',
	deleteOne = '/couple-activity/activity/coupleActivityMain/delete',
	deleteBatch = '/couple-activity/activity/coupleActivityMain/deleteBatch',
	importExcel = '/couple-activity/activity/coupleActivityMain/importExcel',
	exportXls = '/couple-activity/activity/coupleActivityMain/exportXls',
	coupleActivityScenicSpotConnectionList = '/couple-activity/activity/coupleActivityMain/listCoupleActivityScenicSpotConnectionByMainId',
	coupleActivityScenicSpotConnectionSave = '/couple-activity/activity/coupleActivityMain/addCoupleActivityScenicSpotConnection',
	coupleActivityScenicSpotConnectionEdit = '/couple-activity/activity/coupleActivityMain/editCoupleActivityScenicSpotConnection',
	coupleActivityScenicSpotConnectionDelete = '/couple-activity/activity/coupleActivityMain/deleteCoupleActivityScenicSpotConnection',
	coupleActivityScenicSpotConnectionDeleteBatch = '/couple-activity/activity/coupleActivityMain/deleteBatchCoupleActivityScenicSpotConnection',
	coupleActivityWeekPricePerPersonList = '/couple-activity/activity/coupleActivityMain/listCoupleActivityWeekPricePerPersonByMainId',
	coupleActivityWeekPricePerPersonSave = '/couple-activity/activity/coupleActivityMain/addCoupleActivityWeekPricePerPerson',
	coupleActivityWeekPricePerPersonEdit = '/couple-activity/activity/coupleActivityMain/editCoupleActivityWeekPricePerPerson',
	coupleActivityWeekPricePerPersonDelete = '/couple-activity/activity/coupleActivityMain/deleteCoupleActivityWeekPricePerPerson',
	coupleActivityWeekPricePerPersonDeleteBatch = '/couple-activity/activity/coupleActivityMain/deleteBatchCoupleActivityWeekPricePerPerson',
	coupleActivityCalendarList = '/couple-activity/activity/coupleActivityMain/listCoupleActivityCalendarByMainId',
	coupleActivityCalendarSave = '/couple-activity/activity/coupleActivityMain/addCoupleActivityCalendar',
	coupleActivityCalendarEdit = '/couple-activity/activity/coupleActivityMain/editCoupleActivityCalendar',
	coupleActivityCalendarDelete = '/couple-activity/activity/coupleActivityMain/deleteCoupleActivityCalendar',
	coupleActivityCalendarDeleteBatch = '/couple-activity/activity/coupleActivityMain/deleteBatchCoupleActivityCalendar',
}
/**
 * 导出api
 * @param params
 */
export const getExportUrl = Api.exportXls;

/**
 * 导入api
 */
export const getImportUrl = Api.importExcel;
/**
 * 列表接口
 * @param params
 */
export const list = (params) =>
	defHttp.get({ url: Api.list, params });

/**
 * 删除单个
 */
export const deleteOne = (params, handleSuccess) => {
	return defHttp.delete({ url: Api.deleteOne, params }, { joinParamsToUrl: true }).then(() => {
		handleSuccess();
	});
}


export const coupleActivityScenicSpotConnectionList = (params) => {
	if (params['mainId']) {
		return defHttp.get({ url: Api.coupleActivityScenicSpotConnectionList, params });
	}
	return Promise.resolve({});
}
/**
 * 批量删除
 * @param params
 */
export const batchDelete = (params, handleSuccess) => {
	createConfirm({
		iconType: 'warning',
		title: '确认删除',
		content: '是否删除选中数据',
		okText: '确认',
		cancelText: '取消',
		onOk: () => {
			return defHttp.delete({ url: Api.deleteBatch, data: params }, { joinParamsToUrl: true }).then(() => {
				handleSuccess();
			});
		}
	});
}
/**
 * 保存或者更新
 * @param params
 */
export const saveOrUpdate = (params, isUpdate) => {
	let url = isUpdate ? Api.edit : Api.save;
	return defHttp.post({ url: url, params });
}
/**
 * 列表接口
 * @param params
 */
export const coupleActivityWeekPricePerPersonList = (params) => {
	if (params['mainId']) {
		return defHttp.get({ url: Api.coupleActivityWeekPricePerPersonList, params });
	}
	return Promise.resolve({});
}


/**
 * 删除单个
 */
export const coupleActivityWeekPricePerPersonDelete = (params, handleSuccess) => {
	return defHttp.delete({ url: Api.coupleActivityWeekPricePerPersonDelete, params }, { joinParamsToUrl: true }).then(() => {
		handleSuccess();
	});
}
/**
 * 批量删除
 * @param params
 */
export const coupleActivityWeekPricePerPersonDeleteBatch = (params, handleSuccess) => {
	createConfirm({
		iconType: 'warning',
		title: '确认删除',
		content: '是否删除选中数据',
		okText: '确认',
		cancelText: '取消',
		onOk: () => {
			return defHttp.delete({ url: Api.coupleActivityWeekPricePerPersonDeleteBatch, data: params }, { joinParamsToUrl: true }).then(() => {
				handleSuccess();
			});
		}
	});
}
/**
 * 保存或者更新
 * @param params
 */
export const coupleActivityWeekPricePerPersonSaveOrUpdate = (params, isUpdate) => {
	let url = isUpdate ? Api.coupleActivityWeekPricePerPersonEdit : Api.coupleActivityWeekPricePerPersonSave;
	return defHttp.post({ url: url, params });
}
/**
 * 导入
 */
export const coupleActivityWeekPricePerPersonImportUrl = '/activity/coupleActivityMain/importCoupleActivityWeekPricePerPerson'

/**
 * 导出
 */
export const coupleActivityWeekPricePerPersonExportXlsUrl = '/activity/coupleActivityMain/exportCoupleActivityWeekPricePerPerson'

/**
 * 列表接口
 * @param params
 */
export const coupleActivityCalendarList = (params) => {
	if (params['mainId']) {
		return defHttp.get({ url: Api.coupleActivityCalendarList, params });
	}
	return Promise.resolve({});
}


/**
 * 删除单个
 */
export const coupleActivityCalendarDelete = (params, handleSuccess) => {
	return defHttp.delete({ url: Api.coupleActivityCalendarDelete, params }, { joinParamsToUrl: true }).then(() => {
		handleSuccess();
	});
}
/**
 * 批量删除
 * @param params
 */
export const coupleActivityCalendarDeleteBatch = (params, handleSuccess) => {
	createConfirm({
		iconType: 'warning',
		title: '确认删除',
		content: '是否删除选中数据',
		okText: '确认',
		cancelText: '取消',
		onOk: () => {
			return defHttp.delete({ url: Api.coupleActivityCalendarDeleteBatch, data: params }, { joinParamsToUrl: true }).then(() => {
				handleSuccess();
			});
		}
	});
}
/**
 * 保存或者更新
 * @param params
 */
export const coupleActivityCalendarSaveOrUpdate = (params, isUpdate) => {
	let url = isUpdate ? Api.coupleActivityCalendarEdit : Api.coupleActivityCalendarSave;
	return defHttp.post({ url: url, params });
}
/**
 * 导入
 */
export const coupleActivityCalendarImportUrl = '/activity/coupleActivityMain/importCoupleActivityCalendar'

/**
 * 导出
 */
export const coupleActivityCalendarExportXlsUrl = '/activity/coupleActivityMain/exportCoupleActivityCalendar'